// Created on 2024/11/28.
//
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef DCAUTOTEST_PLUGINMANAGER_H
#define DCAUTOTEST_PLUGINMANAGER_H

#include "PluginWindowRender.h"
#include <string>
#include <unordered_map>

#include <js_native_api.h>
#include <js_native_api_types.h>
#include <ace/xcomponent/native_interface_xcomponent.h>
#include <napi/native_api.h>

class PluginManager {
public:
    ~PluginManager();
    static PluginManager *GetInstance() { return &PluginManager::m_pluginManager; }
    void setNativeXComponent(std::string id, OH_NativeXComponent *nativeXComponent);
    PluginWindowRender *getRender(std::string id);
    void Export(napi_env env, napi_value exports);
    void removeComponent(std::string id);

private:
    static PluginManager m_pluginManager;
    std::unordered_map<std::string, PluginWindowRender *> nativeXComponentMap_;
};
#endif // DCAUTOTEST_PLUGINMANAGER_H
